[% setvar title BiDirectional Support in PERL %]
<div id="archive-notice">
    <h3>This file is part of the Perl 6 Archive</h3>
    <p>To see what is currently happening visit <a href="http://www.perl6.org/">http://www.perl6.org/</a></p>
</div>
<div class='pod'>
<a name='TITLE'></a><h1>TITLE</h1>
<p>BiDirectional Support in PERL</p>
<a name='VERSION'></a><h1>VERSION</h1>
<pre>  Maintainer: Roman M. Parparov &lt;<a href='mailto:romm@empire.tau.ac.il'>romm@empire.tau.ac.il</a>&gt;
  Date: 6 Aug 2000
  Mailing List: <a href='mailto:perl6-language@perl.org'>perl6-language@perl.org</a>
  Number: 50
  Version: 1
  Status: Developing</pre>
<a name='ABSTRACT'></a><h1>ABSTRACT</h1>
<p>This paper proposes an RFC regarding the <b>BiDirectional</b> input and
output support which would allow easier correct treatment for the
languages with RTL (Right-To-Left) writing direction, such as
Hebrew, Arabic and others. Such a support would mean a breakthrough
in preparing all kinds of applications of users that need
bidirectional text.</p>
<a name='DESCRIPTION'></a><h1>DESCRIPTION</h1>
<a name='Concepts of Bidirectional Support'></a><h2>Concepts of Bidirectional Support</h2>
<p>The aspects of RTL support in general were outlined in the
<i>BDL ECMA document</i>[1]. Since the bidirectional input issue is much
more complicated than output and requires deep support of other
applications than PERL, this document will only deal with the
string output and string processing, just like the ECMA do.
We will assume that the BDL data is always being read just as it is
being read from the regular input buffer.</p>
<a name='Output of BDL strings in Perl6:'></a><h2>Output of BDL strings in Perl6:</h2>
<p>Based on the above, PERL 6 should implement an output routine like this:</p>
<pre>   rtlprint FILEHANDLE,LIST,REPRESENTATION,DIRECTION
   rtlprint FILEHANDLE,LIST,REPRESENTATION</pre>
<p>FILEHANDLE is the FILEHANDLE of print. LIST is the LIST of 'print'.
REPRESENTATION should be a value represented by a scalar - either
'v' for VISUAL, or 'l' for LOGICAL. LIST is a LIST of
'print'. DIRECTION is either 'rtl' or 'ltr' and is optional, 'rtl'
being the default value.</p>
<p>OR enhance the existing print operator to</p>
<pre>   print FILEHANDLE, LIST, REPRESENTATION,DIRECTION</pre>
<p>In this case the default value of REPRESENTATION is LOGICAL.</p>
<p>The output formats, if left, should be supported by RTL output.</p>
<p>Other outputting statements like &quot;die&quot;, do not have to support
RTL output.</p>
<a name='Data processing of BDL strings in Perl6:'></a><h2>Data processing of BDL strings in Perl6:</h2>
<p><b>Regexp processing</b> for the RTL strings is required. The
'r' char after the last slash would mean an RTL string.</p>
<p>Routine <b>substr</b> should be able to return subroutines cut from the
right side from the RTL strings, including mixed texts.</p>
<a name='IMPLEMENTATION'></a><h1>IMPLEMENTATION</h1>
<p>The implementation of that function should be a thorough coding of
the BiDirectional Languages ECMA spec mentioned above. A mixed
combination of RTL and LTR languages is allowed in a text, and the
rules of punctuation are not often obeyed, but we should just stick
to the ECMA standard.</p>
<a name='REFERENCES'></a><h1>REFERENCES</h1>
<p>[1] Handling of the Bi-Directional Texts - ECMA TR/53 -
<b><i><a href='ftp://ftp.ecma.ch/ecma-tr/tr-053.pdf'>ftp.ecma.ch</a></i></b>
<b><i><a href='ftp://ftp.ecma.ch/ecma-tr/tr-053.psc'>ftp.ecma.ch</a></i></b></p>
</div>
